package com.practice.bootdemo.controller;

import com.practice.bootdemo.common.R;
import com.practice.bootdemo.cond.SystemNameCondConfig;
import com.practice.bootdemo.dto.CodeTestDto;
import com.practice.bootdemo.service.AsyncService;
import com.practice.bootdemo.service.SystemService;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author :zhoushunquan
 * @description: 异步测试
 * @create date: 2022-03-24 17:25:33
 */


@RestController
@RequestMapping(value = "cond")
public class ConditionDemoController {

    @PostMapping(value = "showSystemName")
    public R<String> showSystemName(@RequestBody @Validated(CodeTestDto.Add.class) CodeTestDto codeTestDto) {
        AnnotationConfigApplicationContext context=new AnnotationConfigApplicationContext(SystemNameCondConfig.class);
        SystemService systemService= context.getBean(SystemService.class);
        return R.ok(systemService.showSystemName());
    }

}